<%-- 
    Document   : korisnici
    Created on : Dec 13, 2009, 4:36:31 PM
    Author     : Milan Boricic <boricic@gmail.com>
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<script  language="javascript">
     function confirmDelete()
     {
         return confirm('Da li ste sigurni da želite da obrišete korisnika?');
     }
</script>
<h:form>
    <h:messages />
    <h:outputText value="Pretraga korisnika" style="font-weight: bold;"/> &nbsp;
    <h:inputText value="#{korisnik.searchText}" />&nbsp;
    <h:commandButton value="Traži" action="korisnik.aViewKorisnici" />
    <h:dataTable value="#{korisnik.sviKorisnici}"
                 var="korisnikItem"
                 styleClass="stats"
                 style="white-space:nowrap;">
        <h:column>
            <f:facet name="header">
                <f:verbatim>Ime i prezime</f:verbatim>
            </f:facet>
            <h:outputText value="#{korisnikItem.ime}" />&nbsp;<h:outputText value="#{korisnikItem.prezime}" />
        </h:column>

        <h:column>
            <f:facet name="header">
                <f:verbatim></f:verbatim>
            </f:facet>
            <h:commandButton value="Informacije" action="#{korisnikItem.aViewKorisnikInformacije}" />
        </h:column>

        <h:column>
            <f:facet name="header">
                <f:verbatim></f:verbatim>
            </f:facet>
            <h:commandButton value="Rezervacije" action="#{korisnikItem.aViewKorisnikRezervacije}">
                <f:setPropertyActionListener target="#{korisnikItem.kid}" value="#{korisnikItem.kid}"/>
            </h:commandButton>
        </h:column>

        <h:column>
            <f:facet name="header">
                <f:verbatim></f:verbatim>
            </f:facet>
            <h:commandButton value="Obrisi" action="#{korisnikItem.aDeleteKorisnik}" onclick="if (!confirmDelete()) return false">
                <f:setPropertyActionListener target="#{korisnikItem.kid}" value="#{korisnikItem.kid}"/>
            </h:commandButton>
        </h:column>

        <h:column>
            <f:facet name="header">
                <f:verbatim></f:verbatim>
            </f:facet>
            <h:commandButton value="Rezerviši za" action="#{korisnikItem.aViewRezervisiZa}">
                <f:setPropertyActionListener target="#{korisnikItem.kid}" value="#{korisnikItem.kid}"/>
            </h:commandButton>
        </h:column>

    </h:dataTable>
</h:form>
